/*
 * Copyright (C) 2008-2011 CBDP Consortium
 * 
 * All rights reserved.
 *
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution.
 * 
 * This software consists of contributions made by many individuals, 
 * listed below:
 *
 * Author: 	Xabier Laiseca <xabier.laiseca@deusto.es>
 * 			David Ausín <david.ausin@deusto.es>
 */
package cbdp.server.contextreasoner.impl.util;

import cbdp.server.contextreasoner.exceptions.ContextManagerException;

import com.hp.hpl.jena.rdf.model.Resource;

public class NullChecker
{
	private final static String NULL_PARAMETER_EXCEPTION_1 = "The parameter ";
	private final static String NULL_PARAMETER_EXCEPTION_2 = " can not be null";
	
	public static void checkNullParameter(final Object parameter, final String parameterName)
	{
		if (parameter == null)
		{
			throw new NullPointerException(NULL_PARAMETER_EXCEPTION_1 + parameterName.trim() + NULL_PARAMETER_EXCEPTION_2); 
		}
	}
	
	public static void checkNullResource(final Resource resource, final String message) throws ContextManagerException
	{
		if (resource == null)
		{
			throw new ContextManagerException(message);
		}
	}
}
